 #@layout()
 #define content()

<span class="layui-breadcrumb">
  <a href="/">首页</a>
  <a href="/admin/myWebsitePage"><cite>我的站点</cite></a>
</span>

<hr>
<br/>

<div class="layui-fluid">
	<form class="layui-form">
		<!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
	
		<input type="hidden" name="id" value="#(vo.id)">
	
		<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
			<ul class="layui-tab-title">
				<li class="layui-this">基本信息</li>
				<li>邮箱信息</li>
			</ul>
			<div class="layui-tab-content">
			
				<div class="layui-tab-item layui-show">
					<div class="layui-form-item">
						<label class="layui-form-label">站点名称</label>
						<div class="layui-input-block">
							<input type="text" name="name" placeholder="请输入" value="#(vo.name)"
								autocomplete="off" class="layui-input" 
								lay-verify="">
						</div>
					</div>
				
					<div class="layui-form-item">
						<label class="layui-form-label">二级域名</label>
						<div class="layui-input-block">
							<input type="text" name="sld" placeholder="请输入" value="#(vo.sld)"
								autocomplete="off" class="layui-input" 
								lay-verify="required">
						</div>
					</div>
				
					<div class="layui-form-item">
						<label class="layui-form-label">域名</label>
						<div class="layui-input-block">
							<input type="text" name="domain" placeholder="请输入" value="#(vo.domain)"
								autocomplete="off" class="layui-input" 
								lay-verify="required">
						</div>
					</div>
					
				</div>
				<div class="layui-tab-item">
				
					<div class="layui-form-item">
						<label class="layui-form-label">发件人</label>
						<div class="layui-input-block">
							<input type="text" name="smtp.name" placeholder="请输入" value="#(smtp.name)"
								autocomplete="off" class="layui-input" 
								lay-verify="">
						</div>
					</div>
				
					<div class="layui-form-item">
						<label class="layui-form-label">邮箱账号</label>
						<div class="layui-input-block">
							<input type="text" name="smtp.email" placeholder="请输入" value="#(smtp.email)"
								autocomplete="off" class="layui-input" 
								lay-verify="required">
						</div>
					</div>
				
					<div class="layui-form-item">
						<label class="layui-form-label">邮箱密码</label>
						<div class="layui-input-block">
							<input type="text" name="smtp.password" placeholder="请输入" value="#(smtp.password)"
								autocomplete="off" class="layui-input" 
								lay-verify="required">
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">SMTP</label>
						<div class="layui-input-block">
							<input type="text" name="smtp.host" placeholder="请输入" value="#(smtp.host)"
								autocomplete="off" class="layui-input" 
								lay-verify="required">
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">发送端口</label>
						<div class="layui-input-block">
							<input type="text" name="smtp.port" placeholder="请输入" value="#(smtp.port)"
								autocomplete="off" class="layui-input" 
								lay-verify="required">
						</div>
					</div>
					
					<div class="layui-form-item">
						<label class="layui-form-label">发送方式</label>
						<div class="layui-input-block">
							<input type="radio" name="smtp.way" value="SSL" title="SSL" #(smtp.way=="SSL"?"checked":"")>
     						<input type="radio" name="smtp.way" value="TLS" title="TLS" #(smtp.way=="TLS"?"checked":"")>
						</div>
					</div>
					
				</div>
				
			</div>
		</div>
	
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="detailForm">保存</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
		<!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
	
	
	</form>
</div>

#end

#define js()

<script>

layui.use('form',function(){
	var form = layui.form;
	form.on('submit(detailForm)', function(data) {
		
		//建议使用ajax在此处提交。
		$.ajax({
			type : 'post',
			url : '/admin/myWebsite/save',
			data : $("form").serialize(),
			success : function(data) {
				if (data.code == "0") {
					layer.msg('保存成功！', {
						time : 600
					}, function() {
						initTree();
						initForm();
					});
				}else if(data.code == "err_11001"){
					layer.msg(data.msg, {
						time : 600
					}, function() {
						
					});
				}
			}
		});
		//此处使用异步的好处，服务器端可以直接验证，如果直接提交，提交完成以后，如果验证不通过，那么不方便处理错误的信息
		return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
	});
});

</script>

#end


